# coding=utf-8


# 斐波拉切数列
a, b = 0, 1
for x in range(0, 10):
    a, b = b, a + b
    print(a)  # 1, 1, 2, 3, 5, 8, 13, 21, 34, 55


# 异常捕获

class ParamsTypeError(Exception):
    pass


def foo(args):
    try:
        int_args = int(args)
        print('整数-->', int_args)
    except:
        int_args = ''
        print(ParamsTypeError('Type error'))

    result = int_args + 1
    print('结果-->', result)


list_args = ['1', 'python', 'java', '66', '55.5']
for args in list_args:
    try:
        foo(args)
    except Exception as e:
        print(f'程序出现错误:{e}')



"""
整数--> 1
结果--> 2
Type error
程序出现错误:can only concatenate str (not "int") to str
Type error
程序出现错误:can only concatenate str (not "int") to str
整数--> 66
结果--> 67
Type error
程序出现错误:can only concatenate str (not "int") to str
"""
